import requests
import docx
from docx.shared import Inches#英寸

url = 'https://api.codemao.cn/api/sprite/list/all'
response = requests.get(url)
data = response.json()
res = data['data']['sprite_list']
pic_list = []
for i in res:
    pic_list.append(i['handbook_image'])
for i in range(len(pic_list)):
    res = requests.get(pic_list[i])
    with open(str(i)+'.png', 'wb') as f:
            f.write(res.content)


# file = docx.Document()
# file.add_paragraph('这是我用python创建的文档')
# file.add_picture('https://static.codemao.cn/sprite/handbook-v2/001%E7%BC%96%E7%A8%8B%E7%8C%AB.png', width=Inches(1))
# file.save('test.docx')
